#include "StdAfx.h"
#include "Timer.h"
#include <mmsystem.h>


CTimer::CTimer(void)
{
   __int64 freq;
   QueryPerformanceFrequency((LARGE_INTEGER*)&freq);
   m_timeScale = 1.f / freq;

   QueryPerformanceCounter((LARGE_INTEGER*)&m_lastTime);
   m_timeElapsed = 0;
}

CTimer::~CTimer(void)
{
}

void CTimer::tick(void)
{
   __int64 currTime;
   QueryPerformanceCounter((LARGE_INTEGER*)&currTime);

   m_timeElapsed = (currTime - m_lastTime) * m_timeScale;
   m_lastTime = currTime;
}

float CTimer::getTimeElapsed() const
{
   return m_timeElapsed;
}
